﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Collections.Specialized;
using System.Web;

namespace Studio.Network.Utilities
{
    /// <summary>
    /// Summary description for QueryString.
    /// </summary>
    public class QueryString : NameValueCollection
    {
        private string _queryStringStartChar = "?";
        private string _queryStringSeparatorChar = "&";

        /// <summary>
        /// Returns a UrlEncoded Querystring representation of the values in the namevaluecollection
        /// </summary>
        /// <returns></returns>
        private string ToString()
        {
            return (this.Count == 0) ? string.Empty :
                _queryStringStartChar + string.Join(_queryStringSeparatorChar,
                Array.ConvertAll(this.AllKeys,
                key => string.Format("{0}={1}",
                HttpUtility.UrlEncode(key),
                HttpUtility.UrlEncode(this[key]))));
        }

    } // QueryString

}